import { Injectable } from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {Observable} from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class GoodsService {

  constructor(private http: HttpClient) { }

  // 查询商品类别信息，不包含商品信息
  selectGoodsType(goodsType): Observable<any> {
    return this.http.post<any>(`/gdd/goods/selectGoodsType`, goodsType);
  }

  // 分页查询商品信息，包含商品类别信息
  selectGoodsByPage(goods, pageNumber, pageSize): Observable<any> {
    return this.http.post<any>(`/gdd/goods/selectGoodsByPage/${pageNumber}/${pageSize}`, goods);
  }

  // 修改商品类别信息
  modifyGoodsType(GoodsTypeFormValue): Observable<any> {
    return this.http.post<any>(`/gdd/goods/modifyGoodsType`, GoodsTypeFormValue);
  }

  // 修改商品信息
  modifyGoods(goodsFormValue): Observable<any> {
    return this.http.post<any>(`/gdd/goods/modifyGoods`, goodsFormValue);
  }

  // 删除商品类别信息
  deleteGoodsType(id): Observable<any> {
    return this.http.post<any>(`/gdd/goods/deleteGoodsType`, id);
  }

  // 删除商品信息
  deleteGoods(id): Observable<any> {
    return this.http.post<any>(`/gdd/goods/deleteGoods`, id);
  }
}
